<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    div {
      width: 200px;
      height: 200px;
      padding: 20px;
      border: 20px solid #333;
      margin: 20px;

      background-color: skyblue;
      background-clip: content-box;

      box-sizing: border-box;

      /* display: none; */
      visibility: hidden;
      float: left;
    }
  </style>
</head>
<body>

  <div style="" class="">
  </div>
  <script>

    // var ele = document.querySelector('div');
    // console.log('宽度',ele.offsetWidth); // 内边距+内容+边框
    // console.log('高度',ele.offsetHeight);


    // console.log('宽度',ele.clientWidth); // 内边距+内容
    // console.log('高度',ele.clientHeight);// 不包含边框 
    

    //display  none
    // var ele = document.querySelector('div');
    // console.log('宽度',ele.offsetWidth); // 0
    // console.log('高度',ele.offsetHeight);//0


    // console.log('宽度',ele.clientWidth); //0
    // console.log('高度',ele.clientHeight);// 0

    //visibility: hidden  内容隐藏 但是依然占据位置   所以可以拿到数据
    // var ele = document.querySelector('div');
    // console.log('宽度',ele.offsetWidth); // 200
    // console.log('高度',ele.offsetHeight);//200


    // console.log('宽度',ele.clientWidth); //160
    // console.log('高度',ele.clientHeight);// 160

    
    
  </script>
  </body>


  </html>
